<%@page import="com.asiainfo.util.SessionInfoUtil"%>
<%@page import="com.asiainfo.bean.UserSessionBean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page import="com.asiainfo.bean.MealBean"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
    <%
    String path = request.getContextPath();
    UserSessionBean userSessBean = SessionInfoUtil.getUserSessBean(request.getSession());
    if(userSessBean == null){
		String str = "<script>"
				 +"window.location.href='"+path+"/indexController/index.do'"
		           + "</script>";
		response.getWriter().write(str);
		return;
	}else{ 
		request.setAttribute("userSessBean", userSessBean);
	}
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>靓号办理</title>
<link href="<%=path%>/view/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/view/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/view/css/bootstrap-datetimepicker.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/view/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/view/css/datetimepicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

</script>
<style>
.title{
	width:100%;
	position:absolute;
	top:0;
	background-color:#3cc;
	text-align:center;
	font-family:"Times New Roman", Times, serif;
}
.container{
	margin-top:60px;
}
.head{
	height:20px;
	line-height:20px;
}
.huanyin{
	text-align:center;
	height:20px;
	line-height:20px;
	width:250px;
	float:left;
}
.exit{
	text-align:center;
	height:20px;
	line-height:20px;
	width:100px;
	float:left;
}
#xiangqing{
	text-align:center;
	height:20px;
	line-height:20px;
	font-size:12px;
	z-index:99;

}
.consumption{
	margin-top:10px;
}

</style>
</head>
<body>
<div class="title">
	<h3>掌上电信业务助手</h3>
</div>
<div class="container">
	<div class="head">
		<div class="row">
			<div class="huanyin col-sm-3 col-sm-offset-2 col-xs-3 collapsed" data-toggle="collapse" data-target="#xiangqing">
				<p>欢迎您，<a id="username"><%=userSessBean.getUserName()%></a></p>
			</div>
			<div class="exit col-sm-2 col-sm-offset-3 col-xs-3">
				<span><a onclick="loginout()" id="loginout">退出</a></span>
			</div>
		</div>
		<div id="xiangqing" class="collapse col-sm-8 col-sm-offset-2">
			<div  class="row">
				<div class="col-sm-3">
					号码:<span id="number"><%=userSessBean.getPhone()%></span>
				</div>
				<div class="col-sm-3">
					归属地:<span id="address"><%=userSessBean.getCityName()%></span>
				</div>
				<div class="col-sm-3">
					运营:<span id="operator"><%=userSessBean.getOperatorName()%></span>
				</div>
				<div class="col-sm-3">
					话费余额:<span id="money"><%=userSessBean.getReal_time_balance()%>元</span>
				</div>
			</div>
		</div>
	</div>	
	<div class="consumption col-sm-8 col-sm-offset-2 col-xs-12">
		<div class="panel panel-success">
			<div class="panel-heading">
				<div class="row">
					<h4 class="col-sm-10 col-xs-10">可选套餐:${thisremark}</h4>
					<button type="button" class="btn btn-default col-sm-1 col-xs-2" onclick="back()" style="margin-top:5px;"><span aria-hidden="true" style="height:15px;line-height:15px;">返回</span></button>
				</div>
			</div>
			<div class="panel-body">
				<div class="row">
					<p class="col-sm-2 col-xs-5" ><strong>请选择月份：</strong></p>
					<input class="col-sm-2 col-xs-4" style="padding-right:0;padding-left:0;text-align:left" id="endtime" type="text" placeholder="生日/纪念日/车牌" />
					<button class="col-sm-2 col-sm-offset-1 col-xs-2 col-xs-offset-1 btn btn-default " onclick="monthButton()"><span style="height:12px;line-height:12px;">查询</span></button>
					<span style="margin-left:150px; line-height:30px; color:#888;"><input id="fourIpt" onclick="condition_choose();" type="checkbox" />&nbsp;号码不含4</span>
				</div>
				</div>
				<table class="table table-bordered table-primary" >
					<thead>
						<tr>
							<th>电话号码</th>
							<th>卡类型</th>
							<th>操作</th>
						</tr>
					</thead>
                    <c:forEach items="${liangList}" var="value">
                    
					<tbody>
						<tr>
							<td>${value.tel_value}</td>
							<td>${value.card_type}</td>
							<td><button class="btn btn-primary col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1"  id="guch">加入备选</button></td>
						</tr>
					</tbody>
                    </c:forEach>
				</table>
			</div>
		</div>
	</div>

	
<script type="text/javascript" src="<%=path%>/view/js/DatePicker.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/bootstrap.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/DatePicker2.js"></script>
<script type="text/javascript" src="<%=path%>/view/js/jquery-2.1.4.min.js"></script>

<script src="http://cdn.bootcss.com/bootstrap/2.3.1/js/bootstrap-transition.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/2.3.1/js/bootstrap-modal.js"></script>


<script type="text/javascript">
 function loginout(){  
    
   		var actionUrl= "<%=path%>/loginController/logout.do";
   	 
       $.ajax({  
           url:actionUrl,  
           type:"post",  
           dataType : "JSON",
		    cache:false,
		   success:function(data){  
           	window.location.href = "<%=path%>/loginController/login.do";	 
           }, 
       error: function(req) {
			alert("退出失败");
		}
       });  
   }
 function condition_choose() {
	var actionUrl= '<%=path%>/mobileController/liangChoice.do';
 	var bo = "flase";
 	var cb1=document.getElementById("fourIpt");
 	if(cb1.checked){
	 	bo = "true";
	 }else{
	 	bo = "flase";
 	}
 $.ajax({  
     url:actionUrl,  
     type:"post",  
     dataType : "JSON",
	    cache:false,
	    data:{"boolean":bo,},
	    success:function(data){  
       	 if(data.flag == true){
       		window.location.href = "<%=path%>/mobileController/liangChoiceView.do";
       	 }else if(data.flag == false){
       		 alert("失败1");
       		// window.location.href = "<%=path%>/indexController/index.do";
       	 }
        }, 
         error: function(req) {
       	 alert("失败2");
        }  
 });  
 }

 
 function back(){
		window.location.href = "<%=path%>/liangController/mealChoiceView.do";
 }
 </script>
</body>
</html>